package com.greenold.check.controller;

import com.greenold.check.domain.Dto.PendingTasksDto;
import com.greenold.check.domain.PendingTasks;
import com.greenold.commen.service.WorkFlowServie;
import com.greenold.common.core.domain.AjaxResult;
import com.greenold.common.utils.SecurityUtils;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/applications")
public class ApplicationsController {
    @Autowired
    private WorkFlowServie workFlowServie;
    @PostMapping("/selectByPage")
    public AjaxResult selectByPage(@RequestBody PendingTasksDto pendingTasksDto) {
        System.out.println(pendingTasksDto.getReqType());
        Long userId = SecurityUtils.getUserId();
        pendingTasksDto.setApplicatId(userId.toString());
        List<PendingTasks> myTaskList = workFlowServie.getMyTaskList(pendingTasksDto);
        return AjaxResult.success(myTaskList);
    }
}
